package com.guyuan.live_meeting.utils;

import com.guyuan.live_meeting.bean.StaffBean;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class UmengUtils {
    private UmengUtils(){

    }

    public static String genUserAlias(String userName,long userId){
        return userName+"::"+userId;
    }

    public static StaffBean getStaffByUserAlias(String userAlias) {
        String[] strings = userAlias.split("::");
        StaffBean staffBean = new StaffBean();
        if(strings.length==2){
            staffBean.setName(strings[0]);
            staffBean.setId(Long.parseLong(strings[1]));
        }
        return staffBean;
    }

    public static List<StaffBean> getReceiversByUserAliases(String receivedUsers) {
        List<StaffBean> result = new ArrayList<>();
        String[] aliases = receivedUsers.split(",");
        for (String alias : aliases) {
            result.add(getStaffByUserAlias(alias));
        }
        return result;
    }
}
